# INSTALL_PATH; 执行 make install 时,会将生成的 so 复制到该目录下.
SO_NAME      = SpatialFilter
SO_NORNAME   = lib$(SO_NAME).so
INSTALL_PATH = ../../bin/algo

CXXFILES     = $(shell find -L . -type f -name '*.cc')
CFILES       = $(shell find -L . -type f -name '*.c')
OBJECTS      = $(CXXFILES:.cc=.cc.o) $(CFILES:.c=.c.o)

INCLUDESDIR = 
DEFINES     =         
CFLAGS      = -O2 -Wall
CXXFLAGS    = $(CFLAGS) 
LDFLAGS     = -O2

all: $(SO_NORNAME)

# 注意,虽然算法库中使用了 opencv_core,opencv_highgui,opencv_imgproc 中的接口,
# 但由于这些这些接口在 bishe 主程序中已经链接,所以这里不需要单独链接.
$(SO_NORNAME): $(OBJECTS)
	$(CXX) -o $(SO_NORNAME) $(OBJECTS) $(LDFLAGS) -shared

./%.cc.o: ./%.cc
	$(CXX) -o $@ $< -c -fPIC $(CXXFLAGS) $(DEFINES) $(INCLUDESDIR)
./%.c.o: ./%.c
	$(CC)  -o $@ $< -c -fPIC $(CFLAGS)   $(DEFINES) $(INCLUDESDIR)
	
install: $(SO_NORNAME)
	mkdir -p $(INSTALL_PATH)
	cp -fv $(SO_NORNAME) $(INSTALL_PATH)/$(SO_NORNAME)
uninstall:
	rm -fv $(INSTALL_PATH)/$(SO_NORNAME)

clean:
	rm -fv $(OBJECTS)
	rm -fv $(SO_NORNAME)




